<template>
	<view class="wrap">
		<view class="logo">登录</view>

		<view class="list">
			<view class="list-call">
				<view class="iconfont icon-avatar" style="font-size: 22px;color:#5473e8;"></view>
				<input class="u-input" placeholder-class="u-input--placeholder" type="text" v-model="username" maxlength="32"
					:placeholder="$t('login.placeholderAccount')" />

			</view>
			<view class="list-call">
				<view class="iconfont icon-key" style="font-size: 22px;color:#5473e8;"></view>
				<input class="u-input" placeholder-class="u-input--placeholder" type="text" v-model="password" maxlength="32"
					:placeholder="$t('login.placeholderPassword')" :password="!showPassword" />
				<image class="u-icon-right"
					:src="'/static/aidex/login/eye_' + (showPassword ? 'open' : 'close') + '.png'" @click="showPass()">
				</image>
			</view>
			<div style="padding:15rpx 0 0;">
<!-- 				<view class="register">
					<navigator class="register-link" url="forget" open-type="navigate">{{$t('login.forget')}}
					</navigator>
				</view> -->
				<u-checkbox v-model="remember" active-color="#5473e8">记住密码</u-checkbox>
			</div>
		</view>
		<view class="button" @click="submit('1')"><text>登录</text></view>
		<view class="login-bottom-box">
		
			<view class="copyright">
				登录即代表您已阅读并同意<u-link href="#">用户协议</u-link> 与 <u-link href="#">隐私政策</u-link>
			</view>
		</view>

	</view>
</template>
<script>
	/**
	 * Copyright (c) 2013-Now http://aidex.vip All rights reserved.
	 */
	import base64 from '@/common/base64.js';
	export default {
		data() {
			return {
				username: '',
				password: '',
				showPassword: false,
				remember: true,
			};
		},
		onLoad() {
			// this.$u.api.index({
			// 	loginCheck: true
			// }).then(res => {
			// 	if (res.code == '200') {
			// 		uni.reLaunch({
			// 			url: '/pages/sys/workbench/index'
			// 		});
			// 	}
			// });
			uni.reLaunch({
				url: '/pages/sys/workbench/index'
			});
		},
		methods: {
			showPass() {
				this.showPassword = !this.showPassword;
			},
	
			submit() {
				if (this.username.length == 0) {
					this.$u.toast('请输入账号');
					return;
				}
				if (this.password.length == 0) {
					this.$u.toast('请输入密码');
					return;
				}
				this.$u.api.login({
						username: this.username,
						password: this.password,
					})
					.then(res => {
						if (res.msg) {
							this.$u.toast(res.msg);
						}
						if (res.code == '200') {
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/sys/workbench/index'
								});
							}, 500);
						}
				
					});
			},
			
		}
	};
</script>
<style lang="scss">
	@import 'index.scss';

	.logo {
		font-size: 48rpx;
		color: #5473e8;
		margin: 80rpx auto 80rpx auto;
	}

	.list-call-icon {
		color: #ff0000;
		.u-input--placeholder{
			font-size: 30rpx;
		}
	}

	.currentPhone-box {
		text-align: center;
		padding: 40rpx 80rpx;

		.number-text {
			color: #000000;
			font-size: 60rpx;
		}

		.other-text {
			color: #999999;
			font-size: 26rpx;
			padding: 20rpx 0;
		}

		.u-btn {
			margin: 30rpx auto;
		}

		.u-hairline-border {
			border: 1px solid #fff;
		}
	}

	.register {
		display: inline-block;
		color: #5473e8;
		height: 40rpx;
		line-height: 40rpx;
		font-size: 28rpx;
		float: right;
		margin-top: 6rpx;
	}

	.register-link {
		float: right;
		padding: 0 16rpx;
	}

	.reg-link {
		display: inline-block;
		color: #5473e8;
	}

	.oauth2 {
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		margin: 0rpx 100rpx 30rpx;

		image {
			height: 80rpx;
			width: 80rpx;
		}
	}

	.u-tabs {
		padding: 0 70rpx;
	}
</style>